package com.mall.shopping.converter;

import com.mall.shopping.dal.entitys.Item;
import com.mall.shopping.dal.entitys.Panel;
import com.mall.shopping.dal.entitys.PanelContent;
import com.mall.shopping.dto.PanelContentItemDto;
import com.mall.shopping.dto.PanelDto;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

import java.util.List;

@Mapper(componentModel = "spring")
public interface RecommendProductConverter {

    @Mappings({
            @Mapping(source = "panel.id",target = "id"),
            @Mapping(source = "panel.name",target = "name"),
            @Mapping(source = "panel.type",target = "type"),
            @Mapping(source = "panel.sortOrder",target = "sortOrder"),
            @Mapping(source = "panel.position",target = "position"),
            @Mapping(source = "panel.limitNum",target = "limitNum"),
            @Mapping(source = "panel.status",target = "status"),
            @Mapping(source = "panel.remark",target = "remark")
    })
    PanelDto PanelToPanelDto(Panel panel);

    @Mappings({
            @Mapping(source = "panelContent.id",target = "id"),
            @Mapping(source = "panelContent.panelId",target = "panelId"),
            @Mapping(source = "panelContent.type",target = "type"),
            @Mapping(source = "panelContent.productId",target = "productId"),
            @Mapping(source = "panelContent.sortOrder",target = "sortOrder"),
            @Mapping(source = "panelContent.fullUrl",target = "fullUrl"),
            @Mapping(source = "panelContent.picUrl",target = "picUrl"),
            @Mapping(source = "panelContent.picUrl2",target = "picUrl2"),
            @Mapping(source = "panelContent.picUrl3",target = "picUrl3"),
            @Mapping(source = "panelContent.created",target = "created"),
            @Mapping(source = "panelContent.updated",target = "updated"),
            @Mapping(source = "panelContent.productName",target = "productName"),
            @Mapping(source = "panelContent.salePrice",target = "salePrice"),
            @Mapping(source = "panelContent.subTitle",target = "subTitle")
    })
    PanelContentItemDto PanelContentToPanelCotentItemDto(PanelContent panelContent);

    List<PanelContentItemDto> PanelContentItemDtos(List<PanelContent> panelContents);
}
